package com.hzdesk.media.matvector.koreabatch.client.my_paperless.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.hzdesk.media.matvector.koreabatch.client.my_paperless.R;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.base.BaseAdapter;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.base.BaseViewHolder;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.bean.DevicesUndeMettingBean;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.view_holder.DevicesUndeMettingViewHolder;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Administrator on 2018/8/9.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 */

public class DevicesUndeMettingAdapter<T> extends BaseAdapter{

    private final SimpleDateFormat sdf;

    public DevicesUndeMettingAdapter(Context mContext) {
        super(mContext);
        sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    }

    @Override
    protected int getItemLayout() {
        return R.layout.my_recyclerview_item_devices_unde_metting;
    }

    @Override
    protected BaseViewHolder getItemViewHolder(View view) {
        return new DevicesUndeMettingViewHolder(view);
    }

    @Override
    protected void onMyBindViewHolder(BaseViewHolder holder, int position) {
        DevicesUndeMettingViewHolder mettingViewHolder = (DevicesUndeMettingViewHolder) holder;
        DevicesUndeMettingBean bean = (DevicesUndeMettingBean) mlist.get(position);
       int meeetshare =  bean.getMeetShare();
       if(meeetshare == 20){                                                                        // 不公开
           mettingViewHolder.getIv_has_openly().setImageResource(R.mipmap.has_no_openly);
       }else{                                                                                       //公开
           mettingViewHolder.getIv_has_openly().setImageResource(R.mipmap.has_openly);
       }
      String name =   bean.getName();
       mettingViewHolder.getTv_metting_name().setText(name);
        long meetTime =   bean.getMeetTime();
        // 格式化时间
        mettingViewHolder.getTv_metting_date().setText(sdf.format(new Date(meetTime)));
    }

}
